package com.easyrecite.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class MySQLHelper {
    private static String driver = "com.mysql.jdbc.Driver";
    private static String url = "jdbc:mysql://101.200.210.67:3306/word?useUnicode=true&" +
            "characterEncoding=utf8&useSSL=false&serverTimezone=UTC";
    private static String user = "root";//用户名
    private static String password = "lcmysql1204";//密码

    public static Connection getConnection(){
        Connection connection = null;
        try {
            Class.forName(driver);
            connection = (Connection) DriverManager.getConnection(url,user,password);//获取连接
        } catch (ClassNotFoundException e) {
            System.out.println("ClassNotFoundException");
            e.printStackTrace();
        } catch (SQLException e) {
            System.out.println("SQLException");
            e.printStackTrace();
        }
        return connection;
    }
}
